#include <stdio.h>
int main() 
{
    double price = 0, flprice = 0;
    int month = 0,day = 0,bool = 0;
    scanf("%lf %d %d %d %d",&price,&month,&day,&bool);
    if(month == 11 && day == 11) 
    { 
          flprice = price*0.7-bool*50; 

    }
    
    else if(month == 12 && day == 12)
    {  
           flprice = price*0.8-bool*50;
    }
    if(flprice < 0)
    {
           printf("0.00\n");
    }
    
    else
    {
          printf("%.2lf\n",flprice);
    }
    return 0;
}

